package com.chb.rpc;

import java.net.ServerSocket;
import java.net.Socket;
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.Executor;
import java.util.concurrent.Executors;

/**
 * @description:
 * @author: CHB
 * @create: 2022-03-14 11:06
 **/
public class RpcService {

    private static final Executor executor = Executors.newCachedThreadPool();


    public static void main(String[] args) throws Exception {



        for(int i = 0 ; i < 10 ; i++){
            try (
                    ServerSocket serverSocket = new ServerSocket(9898);
            ) {
                // 启动
                System.out.println("起dong");
                Socket socket = serverSocket.accept();
                executor.execute(new RpcProcessHandler(socket));
            }catch (Exception e){
                e.printStackTrace();
            }
        }
    }
}
